const showMsgEle = document.getElementById("show-msg");
const inputMsgEle = document.getElementById("input-msg-ele");
const sendMsgBtn = document.getElementById("send-msg-btn");

// 创建/加入广播频道
const bc = new BroadcastChannel("test");
sendMsgBtn.addEventListener("click", (event) => {
  console.log(inputMsgEle.value);
  bc.postMessage({
    form: "testA",
    value: inputMsgEle.value,
  });
});

bc.onmessage = function (e) {
  showMsgEle.value = e.data.value;
};
